package com.house.common;

import lombok.Data;

import java.io.Serializable;


/**
 * 公共返回类
 */
@Data
public class Result implements Serializable {

    private boolean success;

    private Object data;

    private String msg;


    public static Result ok() {
        Result result = new Result();
        result.setSuccess(true);
        return result;
    }

    public static Result ok(Object data) {
        Result result = new Result();
        result.setSuccess(true);
        result.setData(data);
        return result;
    }

    public static Result error() {
        Result result = new Result();
        result.setSuccess(false);
        result.setMsg("网络错误");
        return result;
    }

    public static Result error(String msg) {
        Result result = new Result();
        result.setSuccess(false);
        result.setMsg(msg);
        return result;
    }
}
